package org.example.springcloud.controller;

import org.example.springcloud.feign.FeignClient01;
import org.example.springcloud.feign.FeignClient02;
import org.example.springcloud.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    @Autowired
    FeignClient01 feignClient01;
    @Autowired
    FeignClient02 feignClient02;

    @GetMapping("/order/{id}")
    public User getUser(@PathVariable long id) {

        User order = feignClient01.getOrder(id);

        return order;
    }
    @GetMapping("/{serviceName}")
    String getServiceName(@PathVariable  String serviceName){
        return feignClient02.getServiceName(serviceName);

    }
}
